package com.yyy.dm.consumer.controller;

import com.yyy.dm.CommonResponse;
import com.yyy.dm.consumer.service.LinkUserConsumerService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/user")
public class LinkUserConsumerController {

    @Resource
    private LinkUserConsumerService linkUserConsumerService;
    //查询常用购票人
    @PostMapping("/permission/order/ticketbuyerlist")
    public CommonResponse ticketBuyerList(@RequestBody Map<String,Long> map){
        return linkUserConsumerService.ticketBuyerList(map.get("userId"));
    }

    //查询购票人是否存在
    @PostMapping("/permission/order/validatebuyerexist")
    public CommonResponse validateBuyerExist(@RequestBody Map<String,String> map){
        return linkUserConsumerService.validateBuyerExist(map.get("idCard"));
    }
    //添加常用购票人
    @PostMapping("/permission/order/addticketbuyer")
    public CommonResponse addTicketBuyer(@RequestBody Map<String,String> map){
        return linkUserConsumerService.addTicketBuyer(map);
    }
    //删除常用购票人
    @PostMapping("/permission/order/deleteticketbuyer")
    public CommonResponse deleteTicketBuyer(@RequestBody Map<String,Long> map){
        return linkUserConsumerService.deleteTicketBuyer(map.get("linkId"));
    }
}
